<template>
  <div>
    <div class="top">
      <div class="info-box">
        <div class="avater">
          <img :src="designerInfo.avatar" alt />
        </div>
        <div class="name">{{ designerInfo.name }}</div>
        <div class="desc">
          <p class="company">{{ designerInfo.company_name }}</p>
          <p
            class="style"
          >擅长风格：{{ designerInfo.styles.length ? designerInfo.styles.join('，') : '无' }}</p>
        </div>
      </div>
      <div class="intro-box">
        <div class="year">
          <p class="name">从业年限</p>
          <p class="txt">{{designerInfo.work_age}}<span v-if="designerInfo.work_age !== '10年以上'">年</span> </p>
        </div>
        <div class="standard">
          <p class="name">收费标准</p>
          <p class="txt">{{ designerInfo.rates }}元/平米</p>
        </div>
        <div class="type">
          <p class="name">设计类型</p>
          <p class="txt">{{ parseInt(designerInfo.form) === 1 ? '整装' : '软装' }}</p>
        </div>
      </div>
      <div class="edit">
        <slot name="edit"></slot>
      </div>
    </div>
    <div class="content" v-if="designerInfo.case.length">
      <div
        class="panel-item"
        @click="$emit('worksDetail', item)"
        v-for="(item, index) of designerInfo.case"
        :key="index"
      >
        <div class="img-box">
          <img :src="item.cover" alt />
        </div>
        <div class="txt">{{ item.title }}</div>
      </div>
    </div>
    <no-result
      v-else
      class="noresult-wrapper"
      :src="require('@/assets/images/1-zwnr.png')"
      msg="暂无作品"
    />
    <slot name="bottom"></slot>
  </div>
</template>
<script>
import NoResult from '@/components/no-result/no-result'
export default {
  props: {
    designerInfo: {
      type: Object,
      default: () => ({})
    }
  },
  components: {
    NoResult
  }
}
</script>
<style lang="scss" scoped>
@import "@/styles/mixin.scss";
.top {
  width: 100%;
  height: 7.3rem;
  background: rgba(255, 255, 255, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  .info-box {
    margin-top: 1.1rem;
    text-align: center;
    .avater {
      width: 1.6rem;
      height: 1.6rem;
      margin: 0 auto;
      overflow: hidden;
      border-radius: 50%;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .name {
      font-size: 0.36rem;
      font-family: PingFang SC;
      font-weight: 500;
      color: rgba(0, 4, 0, 1);
      margin-top: 0.4rem;
    }
    .desc {
      margin-top: 0.3rem;
      p {
        font-size: 0.22rem;
        font-family: PingFang SC;
        font-weight: 300;
        color: rgba(153, 153, 153, 1);
        line-height: 0.22rem;
        text-align: center;
        &.style {
          padding: 0 1rem;
          box-sizing: border-box;
          line-height: 0.4rem;
          margin-top: 0.2rem;
        }
      }
    }
  }
  .intro-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.85rem;
    width: 100%;
    padding: 0 0.7rem;
    box-sizing: border-box;
    .year,
    .standard,
    .type {
      text-align: center;
      .name {
        font-size: 0.22rem;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(153, 153, 153, 1);
        line-height: 0.22rem;
      }
      .txt {
        font-size: 0.26rem;
        line-height: 0.26rem;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(0, 4, 0, 1);
        margin-top: 0.3rem;
      }
    }
  }
  .edit {
    position: absolute;
    top: 0.3rem;
    right: 0.36rem;
  }
}
.content {
  width: 100%;
  padding: 0.52rem 0.36rem;
  padding-bottom: 1.5rem;
  box-sizing: border-box;
  text-align: center;
  font-size: 0.24rem;
  font-family: PingFang SC;
  font-weight: 500;
  color: rgba(0, 4, 0, 1);
  .panel-item {
    width: 100%;
    margin-bottom: 0.42rem;
    &:last-of-type {
      margin-bottom: 0;
    }
    .img-box {
      width: 100%;
      height: 3.8rem;
      overflow: hidden;
      img {
        width: 100%;
      }
    }
    .txt {
      width: 100%;
      font-size: 0.24rem;
      font-family: PingFang SC;
      font-weight: 500;
      color: rgba(0, 4, 0, 1);
      font-weight: bold;
      line-height: 1rem;
      text-align: left;
      padding: 0 0.32rem;
      box-sizing: border-box;
      background: #fff;
    }
  }
}
.noresult-wrapper /deep/ .no-result {
  top: 7.5rem;
}
</style>
